<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>DataClean</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

</head>
<body>

<div class="model">
    <div class="modal-dialog">
        <div class="modal-header">
            <h4 class="modal-title">提示</h4>
        </div>
        <div class="modal-body" >
            <form id="file-upload" action="/file/fileUpload" method="post" enctype="multipart/form-data" onsubmit="return check();">
                <div class="form-group">
                    <input type="file" name="file" id="file">
                </div>
                <input id="file_button" style="padding:4px 12px;font-size: 12px"
                       class="btn btn-primary" type="submit" value="一键转换"/>
            </form>
        </div>

    </div>

</div>


<script type="application/javascript">

    function check() {
        var file = $("#file").val();

        if (file === "" || file.length === 0) {
            alert("请选择文件路径！");
            return false;
        }
        if(file.indexOf("json")<0){
            alert("文件格式不对,请检查");
            return false;
        }
        showHtmlSwal("文件正在上传,请稍候,详情请看导入结果", "");
        return true;
    }

    function showHtmlSwal(title, message) {
        swal({
            title: "<small>" + title + "</small>",
            text: "<span style=\"color:#F8BB86\">" + message + "<span>",
            html: true
        });
    }


</script>

<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
</body>
</html>